package club.cearnach.core.util;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 阮胜
 * @date 2018/4/2 15:25
 */
public class UserAgentUtil {
    /**
     * 获取客户端访问方式(pc,android,ios)
     *
     * @return
     */
    public static String getUserAgent(HttpServletRequest request) {
        String userAgent = request.getHeader("user-agent");
        if (userAgent.contains("Android")) {
            return "Android";
        } else if (userAgent.contains("iPhone") || userAgent.contains("iPad")) {
            return "IOS";
        } else {
            return "PC";
        }
    }
}